package com.song.dbdao;

import com.song.damain.Student;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

/**
 * Created by wangsong on 2015/6/3.
 */
public class PersonDao {

    private SessionFactory sessionFactory;


    private Session getSession(){
        return sessionFactory.getCurrentSession();
    }


    public Student findAll(){

        return (Student) getSession().createQuery("from Student").list().get(0);
    }





    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }
}
